import instance from '../utils/request';
import type { Teacher, TeacherListResponse, TeacherResponse } from '../models/teacherModel';

// 教师表单数据接口
export interface TeacherFormData {
  name: string;
  intro: string;
  career: string;
  level: number;
  avatar?: string;
  sort?: number;
}

// 通用API响应接口
export interface ApiResponse {
  code: number;
  success: boolean;
  message: string;
  data?: any;
}

// 获取所有讲师列表
export const getTeacherList = (): Promise<TeacherListResponse> => {
  return instance.get('/eduservice/teacher/findAll');
}

// 实际删除API响应接口
export interface DeleteResponse {
  status: number;
  msg: string;
  data: any | null;
}

// 删除讲师(逻辑删除)
export const deleteTeacher = (id: string): Promise<any> => {
  return instance.delete(`/eduservice/teacher/${id}`);
};

// 添加讲师
export const addTeacher = (eduTeacher: TeacherFormData): Promise<any> => {
  return instance.post('/eduservice/teacher/addTeacher', eduTeacher);
};


